package proyecto.domain;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotNull;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
import org.springframework.roo.addon.tostring.RooToString;

@RooJavaBean
@RooToString
@RooJpaActiveRecord(finders = { "findAreasByUsuarios" })
public class Area {

    @NotNull
    @Column(unique = true)
    private String nombre_area;

    @ManyToMany(cascade = CascadeType.ALL, mappedBy = "areas")
    private Set<Sucursal> sucursales = new HashSet<Sucursal>();

    @OneToMany
    private Set<Usuario> usuarios = new HashSet<Usuario>();
}
